<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/jsp/comm_css_include.jsp"%>
<!doctype html>
<html>
<head>
<style type="text/css">
	.ibox-content{
		border: none;
	}
</style>
</head>
<body class="gray-bg">
<div class="container creditbody">
	 <div class="iboxtitle">
	 	<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;贷后业务>逾期风控>拖车成功登记</span>
     </div>
     <div class="buttonfixed">
       <button class="btn-danger-my btn  btn-primary" type="button" onclick="tcjlSave();" >保存</button>
    </div>
	<input type="hidden" id="busiId"/>
	<input type="hidden" id="cusId"/>
	<input type="hidden" id="tralierId"/>
      <form class="form-horizontal business-form" id="commentForm">
         <div class="business-padding">
			<table cellpadding="0" cellspacing="0" border="0" class="buyinfor-table">
				
				<tr>	
					<td align="right">
						<label class="control-label np">拖回日期：</label>
					</td>
					<td>
						<input id="th_timeSuccess" name="th_timeSuccess" placeholder="拖回日期(必填)"  type="text" class="laydate-icon form-control" required=""  />
					</td>
					
					<td align="right">
						<label class="control-label np">拖回地：</label>
					</td>
					<td>
					 	<input id="addrParkSuccess" name="addrParkSuccess" placeholder="拖回地(必填)" type="text" class="form-control" required=""  />
					</td>
					<td align="right">
						<label class="control-label np">车钥匙：</label>
					</td>
					<td>
					 	<input id="keyCar" name="keyCar" type="text" class="form-control"  />
					</td>
				</tr>
				
				<tr>	
					<td align="right">
						<label class="control-label np">执行组别：</label>
					</td>
					<td>
						<select id="executor" name="executor"   class="select-control" ></select>
					</td>
					
					<td align="right">
						<label class="control-label np">行驶证：</label>
					</td>
					<td>
					 	<select id="statusDrivingLicense" class="select-control">
							<option value="0">无</option>
							<option value="1">有</option>
						</select>
					</td>
					<td align="right">
						<label class="control-label np">购置税：</label>
					</td>
					<td>
					 	<select id="statusPurchaseTax" class="select-control">
							<option value="0">无</option>
							<option value="1">有</option>
						</select>
					</td>
				</tr>
				
				<tr>	
					<td align="right">
						<label class="control-label np">登记证书：</label>
					</td>
					<td>
						<select id="statusCertificateRegistration" class="select-control">
							<option value="0">无</option>
							<option value="1">有</option>
						</select>
					</td>
					
					<td align="right">
						<label class="control-label np">购车发票：</label>
					</td>
					<td>
					 	<select id="statusBill" name="gcr_workAge" class="select-control">
							<option value="0">无</option>
							<option value="1">有</option>
						</select>
					</td>
					<td align="right">
						<label class="control-label np">欠养路费：</label>
					</td>
					<td>
					 	<select id="statusOwe" class="select-control">
							<option value="0">无</option>
							<option value="1">有</option>
						</select>
					</td>
				</tr>
				
				<tr>	
					<td align="right">
						<label class="control-label np">违章：</label>
					</td>
					<td>
						<select id="statusBreak" name="gcr_workAge" class="select-control">
							<option value="0">无</option>
							<option value="1">有</option>
						</select>
					</td>
				</tr>
				
				<tr>
					<td align="right" valign="top">
						<label class="control-label np">车况备注：</label>
					</td>
					<td colspan="4">
						<textarea id="remarkCar"  class="form-control" rows="1"></textarea>
					</td>
				</tr>
				
				<tr>
					<td align="right" valign="top">
						<label class="control-label np">养路费备注：</label>
					</td>
					<td colspan="4">
						<textarea id="remarkToll" type="text"  class="form-control" rows="1"></textarea>
					</td>
				</tr>
				
				<tr>
					<td align="right" valign="top">
						<label class="control-label np">违章备注：</label>
					</td>
					<td colspan="4">
						<textarea id="remarkBreak" type="text" class="form-control" rows="1"></textarea>
					</td>
				</tr>
				<tr>
					<td align="right" valign="top">
						<label class="control-label np">综合备注：</label>
					</td>
					<td colspan="4">
						<textarea id="remarkTotal" type="text" class="form-control" rows="1"></textarea>
					</td>
				</tr>
				<tr>
					<td align="right" valign="top">
						<label class="control-label np">车辆其他物品：</label>
					</td>
					<td colspan="4">
						<textarea id="goodsOther" type="text" class="form-control" rows="1"></textarea>
					</td>
				</tr>
				<tr>
					<td align="right" valign="top">
						<label class="control-label np">车辆其他物品：</label>
					</td>
					<td colspan="4">
						<textarea id="dataOther" type="text" class="form-control" rows="1"></textarea>
					</td>
				</tr>
				<tr>
					<td align="right" valign="top">
						<label class="control-label np">备注：</label>
					</td>
					<td colspan="4">
						<textarea id="remarks" type="text" class="form-control" rows="1"></textarea>
					</td>
				</tr>
			</table>
		
			<table cellpadding="0" cellspacing="0" border="0" class="thead-table">
				<thead class="thead-a">
				    <tr>
				      <th>发动机号</th>
					  <th>底盘号</th>
					  <th>公里数</th>
					  <th>拖车费用</th>
				      <th>车辆维修费</th>
				      <th>其他费用</th>
				    </tr>
				</thead>
				<tbody class="tbody-a">
				    <tr>
				      <td>
				      	<input id="engineNumber" name="engineNumber" type="text" class="tbody-control" placeholder="(必填)" required=""  />
				      </td>
				      <td>
				      	<input id="chassisNumber" name="chassisNumber" type="text" class="tbody-control" placeholder="(必填)" required=""  />
				      </td>
				      <td>
				      	<input id="tcmileage" name="tcmileage" type="text" class="tbody-control" placeholder="(必填)" required=""  />
				      </td>
				      <td>
				      	<input id="costTrailer" name="costTrailer" type="text" class="tbody-control" placeholder="(必填)" required=""  />
				      </td>
				      <td>
				      	<input id="costMaintenance" name="costMaintenance" type="text" class="tbody-control" placeholder="(必填)" required=""  />
				      </td>
				      <td>
				      	<input id="costOther" name="costOther" type="text" class="tbody-control" placeholder="(必填)" required=""  />
				      </td>
				    </tr>
				 </tbody>
			</table>
		</div>
		<div class="business-manwife">
			<span>经办信息</span>
		</div>
		<div class="tche-padding">
		    <table cellpadding="0" cellspacing="0" border="0" class="buyinfor-table">
				<tr>
					<td align="right">
						<label class="control-label np">经办人：</label>
					</td>
					<td> 
						<input class="form-control" type="text" id="tcjx_operator" name="" readonly="readonly" value="${current_user_key.uname}"/>
					</td>	
					<td align="right">
						<label class="control-label np">经办时间：</label>
					</td>
					<td>
						<input id="beg_timeb" name="beg_timeb" placeholder="经办时间(必填)" class="laydate-icon form-control" required="required"/>
					</td>
				</tr>	
			</table>
			
		</div>
	</form>													
</div>
	
	<!-- public quote -->
    <%@include file="/jsp/comm_js_include.jsp"%>

    <!-- custom js -->
    
    <script type="text/javascript"></script>
    
    <!-- layerDate plugin javascript -->
    <script src="${basePath}/js/plugins/layer/laydate/laydate.js"></script>
    <!--
    	作者：zhangpp
    	时间：2017-04-06
    	描述：js
    -->
    <script type="text/javascript">
    
    $(function(){
		$.dpAjax({
	    	url:'${basePath}/DataDictionaryController/getEnableList',
	    	
 			data:{
 				"parentValue":"TrailerExecutor"
 			},
 			success: function(datas){
 				  if(datas.flag == "100100")
					  {
	 					  var result = datas.result.rows;
	 					  var programme_sel=[];
	 				      for(var i=0;i<result.length;i++){
	 				          var programme = result[i];
	 				          programme_sel.push('<option value="'+programme.value+'">'+programme.name+'</option>')
	 				      }
	 				     $("#executor").html(programme_sel.join(' '));
						  return;
					  }
					  if(datas.flag == "100200")
	                  {
						  $.fn.showDatas({"datas":datas});
	                	  return;
	                  }
					  layer.msg(datas.message, {icon: 2});
              }
	    	});
	 });
    
	jQuery(function($) { 
    	laydate({
	        elem: '#beg_timeb', 
	        event: 'focus' 
	    });
    	laydate({
	        elem: '#th_timeSuccess', 
	        event: 'focus' 
	    });
    	$("#busiId").val($.getUrlData("busiId"));
    	$("#cusId").val($.getUrlData("cusId"));
    	$("#tralierId").val($.getUrlData("id"));
    });
	
	var tcjlSave = function () 
	{
		var validstatus = $("#commentForm").valid();
       	var data={};
       	data.creatorName=$("#tcjx_operator").val();
       	data.jbDate=$("#beg_timeb").val();
       	data.creator="${current_user_key.id}";
       	data.busiId= $("#busiId").val();
    	data.cusId= $("#cusId").val();
    	data.trailerId=$("#tralierId").val();
    	data.id=$.getUrlData("id");
       	//拖车成功参数
       		data.statusTrailer=20;
           	data.timeTrailer=$("#th_timeSuccess").val();
           	data.addrPark=$("#addrParkSuccess").val();
           	data.keyCar=$("#keyCar").val();
           	data.executor=$("#executor option:selected").val();
           	data.statusDrivingLicense=$('#statusDrivingLicense option:selected') .val();
           	data.statusPurchaseTax=$('#statusPurchaseTax option:selected') .val();
           	data.statusCertificateRegistration=$('#statusCertificateRegistration option:selected') .val();
           	data.statusBill=$('#statusBill option:selected') .val();
           	data.statusOwe=$('#statusOwe option:selected') .val();
           	data.statusBreak=$('#statusBreak option:selected') .val();
           	data.engineNumber=$("#engineNumber").val();
           	data.chassisNumber=$("#chassisNumber").val();
           	data.mileage=$("#tcmileage").val();
           	data.costMaintenance=$("#costMaintenance").val();
           	data.costOther=$("#costOther").val();
           	data.remarkCar=$("#remarkCar").val();
           	data.remarkToll=$("#remarkToll").val();
           	data.remarkBreak=$("#remarkBreak").val();
           	data.remarkTotal=$("#remarkTotal").val();
           	data.goodsOther=$("#goodsOther").val();
           	data.dataOther=$("#dataOther").val();
           	data.remarks=$("#remarks").val();
           	data.costTrailer=$("#costTrailer").val();
       		if(validstatus){
   			layer.confirm('您确认要提交吗？', {
   	  			  btn: ['确定','取消'] //按钮
   			},function(){
   			layer.closeAll();
        	$.dpAjax({
	    		url:'${basePath}/DhOverdueTrailerRecordController/save',
	    		data:data,
    			success: function(datas){
	    			  if(datas.flag == "100100")
					  {
	    				  window.location.href="${basePath}/web/system/loanAfter/dhOverdueTrailer.jsp";
						  layer.msg('执行成功！', {icon: 6});
						  layer.close();
						  return;
					  }
					  if(datas.flag == "100200")
	                  {
						  $.fn.showDatas({"datas":datas});
	                	  return;
	                  }
                 	}
	    		});
			});
		}
		else{
			layer.msg("有验证未通过，请仔细检查", {icon: 5});
		}
	}
	
	$(function(){	
        $("#commentForm").validate({
        	rules:{
        		costTrailer:{
        			allMoney:true
        		},
        		costMaintenance:{
        			allMoney:true
        		},
        		costOther:{
        			allMoney:true
        		},
        	},
            //重写showErrors
            showErrors: function (errorMap, errorList) {
                
                $.each(errorList, function (i, v) {
                    layer.tips(v.message, v.element, { time: 1500 });
                    return false;
                });  
            },
            /* 失去焦点时验证 */
            onfocusout: function(element) { $(element).valid(); },
            /*  键盘抬起不验证 */
            onkeyup:false,
        });
	});
    </script>
</body>
</html>
